import Constants from "../libs/Constants";
import GameData from "../libs/GameData";
import Helper from "../libs/HelperMgr";
import GameManager from "./GameManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GroundManager extends cc.Component {

    @property(Array(cc.Prefab))
    groundList: Array<cc.Prefab> = new Array();




    start() {
        this.creteGround()
    }

    creteGround() {
        if (GameManager.instace.gameIsStart && !GameManager.instace.gameIsOver) {
            let groundInfo = Constants.StageInfo[GameData.instance.gameStage-1].ground;
            let prefab: cc.Node = cc.instantiate(this.groundList[groundInfo.type]);
            prefab.setParent(this.node);
            prefab.setPosition(groundInfo.pos);
            GameManager.instace.ground = prefab;
        }

    }
}

    








